package com.cn.wanxi.servlet.products;

import com.alibaba.fastjson.JSONObject;
import com.cn.wanxi.model.CaseTypeModel;
import com.cn.wanxi.service.ICaseTypeService;
import com.cn.wanxi.service.impl.CaseTypeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;


@WebServlet("/producat/casetype/casetypesFindll")
public class CaseTypeFindAllServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1.处理乱码
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        //2.接收前台传数据过来


        //3.封装到实体类UserModel

        //4.服务逻辑层
        ICaseTypeService iCaseTypeService=new CaseTypeServiceImpl();
        List<CaseTypeModel> list=iCaseTypeService.CaseTypeFindAll();
        //5.调用得到页面所需要的数据

        //7.将数据转发到页面
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("list",list);
        resp.getWriter().println(jsonObject);
    }
}
